﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM
{
    public class ProcessingInstruction : Node
    {
        internal ProcessingInstruction(Document owner, string _target, string _data)
            : base(owner)
        {
            data = _data;
            target = _target;
        }

        #region DOM Level 1 Compliance

        public override Node cloneNode(bool deep)
        {
            throw new System.NotImplementedException();
        }

        /// <summary>
        /// The content of this processing instruction. This is from the first
        /// non white space character after the target to the character 
        /// immediately preceding the ?>
        /// </summary>
        public string data { get; set; }

        public override string nodeName
        {
            get { return target; }
        }

        public override string nodeValue
        {
            get { return data; }
        }

        public override byte nodeType
        {
            get { return PROCESSING_INSTRUCTION_NODE; }
        }

        /// <summary>
        /// The target of this processing instruction. XML defines this as 
        /// being the first token following the markup that begins the 
        /// processing instruction.
        /// </summary>
        public string target { get; private set; }

        #endregion
    }
}
